import sys
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *


# if __name__ == '__main__':
#     app = QApplication(sys.argv)

#     # 创建树表控件
#     tree = QTreeView()

#     # 创建模型
#     model = QStandardItemModel()
#     model.setHorizontalHeaderLabels(['Name', 'Gender'])

#     # 添加根节点
#     root = QStandardItem('Root')
#     model.appendRow(root)

#     # 添加子节点
#     child1 = QStandardItem('Child1')
#     child1_gender = QStandardItem('Male')
#     child1.appendRow(child1_gender)
#     root.appendRow(child1)

#     child2 = QStandardItem('Child2')
#     child2_gender = QStandardItem('Female')
#     child2.appendRow(child2_gender)
#     root.appendRow(child2)

#     # 设置模型
#     tree.setModel(model)
#     tree.expandAll()

#     # 显示树表控件
#     tree.show()

#     sys.exit(app.exec_())

import sys
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel


class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        # 创建一个 QLabel 并将其设置为状态栏的内容
        self.statusBar().addWidget(QLabel("Ready"))
        # 在状态栏上添加一个新标签
        self.statusBar().addPermanentWidget(QLabel("Right Aligned Label"))

        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Status Bar Example')
        self.show()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = MainWindow()
    sys.exit(app.exec_())
